﻿var vue2 = new Vue({
	el: "body",
	data: {
		user: "",
		top:""
	},
	methods:{
		change:function(e){
			//不登录无法浏览此页面
		var curr = AV.User.current();
		if(curr) {
			console.log("欢迎" + curr.attributes.username + "的光临");
			location.href="xinxia.html?id="+e;
		} else {
			console.log("未登录");
			location.href="../init/init.html?page=1"
		};
			
		}
	},
	created: function() {
		var APP_ID = 'Wx3JTgmqBaARoWCaGI96AM9h-gzGzoHsz';
		var APP_KEY = 'TrVpB16Og6Yac9u3BoiUy4hT';
		AV.init({
			appId: APP_ID,
			appKey: APP_KEY
		});
		
		var cql = 'select * from otherUser where class = "1"';
		AV.Query.doCloudQuery(cql).then(function(data) {
			// results 即为查询结果，它是一个 AV.Object 数组
			vue2.user=data.results;
			console.log(vue2.user);
		}, function(error) {
			console.log("查询失败了");
		});
	}
})